<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"> 
    <h:head></h:head> 
   
  <body> 
      
     
   <p:layout fullPage="true">  
        
    <p:layoutUnit position="north" size="120" style =" text-align : center;"  > 
    		<style type="text/css">
        	.ui-widget{font-size:90% !important;}  
      		</style> 
      		<a href="http://localhost:8080/TravelDreamFelConRusWeb/customer/customerhome.xhtml">
         <p:graphicImage  value="logo.jpg" style=" height:100px;" />
         </a>
		</p:layoutUnit>  
      
   <p:layoutUnit position="center">
   
       <h:form id="signupForm" styleClass="input-form">
		<p:panel header="Registrazione" id="panel">
		<p:messages id="messages" showDetail="true" showSummary="false"
			autoUpdate="true"/>
	<h:panelGrid columns="2">
	    <p:outputLabel value="Username" for="username" />
		<p:inputText id="username" label="Username"
			value="#{auth.username}"
				required="true" />
	
	
		<p:outputLabel value="Nome" for="firstname" />
		<p:inputText id="firstname" label="First Name"
			value="#{auth.firstName}"
				required="true" />
		<p:outputLabel value="Cognome" for="lastname" />
		<p:inputText id="lastname" label="Last Name"
			value="#{auth.lastName}"
				required="true" />
		
		<p:outputLabel value="Email" for="email" />
		
		<p:inputText id="email" required="true" label="email" 
		requiredMessage="Please enter your email address."
		validatorMessage="Invalid email format"
		value="#{auth.email}">
 
	  	<f:validateRegex pattern="^[_A-Za-z0-9-\+]+(\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\.[A-Za-z0-9]+)*(\.[A-Za-z]{2,})$" />
 
		</p:inputText>
		
		
		<p:outputLabel value="Password" for="password" />
		<p:password id="password" label="Password"
			value="#{auth.password}"
			feedback="true" required="true" match="password2" />
		<p:outputLabel value="Confirm" for="password2" />
		<p:password id="password2" label="Password"
			value="#{auth.password}"
			feedback="false" required="true" />
		<p:outputLabel value="Data di nascita" for="birthdate" />
		<p:calendar id="birthdate" value="#{auth.birthdate}" 
			navigator="true" required="true" yearRange="c-100:c-0"
			pattern="MM/dd/yyyy" showOn="button" readonlyInput="true"/>
		<h:outputText value="" />
	
      	<h:panelGroup>
		<p:selectBooleanCheckbox required="true" id="terms"
			label="Accept terms and conditions"
			value="#{auth.acceptedTerms}"
			widgetVar="termsCheckbox" />
		<p:outputLabel value="Accetto i termini e le condizioni d'uso."
			onclick="termsCheckbox.toggle()" for="terms" />
	</h:panelGroup>
      
  
		<p:commandButton value="Registrati"
		action="#{auth.signUp}"
		style="display:block; margin:0 auto;"
		ajax="false" />
	</h:panelGrid>
	
		</p:panel>

	</h:form>			
   
   </p:layoutUnit>
   
   
   
   
   
   
     	
     <p:layoutUnit position="east" size="550" header="Login" resizable="false" closable="false" collapsible="false" >  
          
             <h:form id="login"
		        	onsubmit="document.getElementById('login').action='j_security_check';"
			         prependId="false">
		        <p:panel  id="panel">
		        <p:messages id="messages" showDetail="true" showSummary="false" autoUpdate="true"/>
	            <h:panelGrid columns="2">
	
		            <p:outputLabel for="j_username" value="Username" />
		            <p:inputText id="j_username" name="j_username" required="true" />
		
		            <p:outputLabel for="j_password" value="Password" />
		            <p:password id="j_password" name="j_password" />
		            
		            <p:commandButton id="submit" value="Login" ajax="false" />		
			
	           </h:panelGrid>
		</p:panel>
	</h:form> 
           
      </p:layoutUnit>  
      
    
      
        </p:layout>  
        
        <h:inputHidden  value="#{packageEdit.update()}"/>
		
        
    </body> 
    
    
</html>